package cn.bnuz.edu.liyang.wait_eat_what;

import android.app.Instrumentation;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.textfield.TextInputLayout;

public class Login extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);

        TextInputLayout loginname=(TextInputLayout)findViewById(R.id.loginname);
        TextView textView = (TextView)findViewById(R.id.to_newlogin);
        textView.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Login.this,NewLogin.class);
                startActivity(intent);
            }
        });

        //返回按钮
        Button backbutton = (Button)findViewById(R.id.backbutton1);
        backbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new Thread() {
                    public void run() {
                        try {
                            Instrumentation instrument = new Instrumentation();
                            instrument.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
                        } catch (Exception e) {
                        }            }        }.start();    }});
        //
        //登录按钮
        Button MPButton =(Button)findViewById(R.id.login);
        MPButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Login.this,MainPage.class);

                startActivity(intent);
            }
        });
    }
}
